<?php

declare(strict_types=1);

namespace app\validate;

use think\Validate;

class Members extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'nickname' => ['require', 'max:50'],
        'user' => ['require'],
        'email' => ['require', 'email'],
        'password' => ['require']
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */
    protected $message = [
        'nickname.require' => 'Nickname is required',
        'user.require' => 'Account is required',
        'email.email' => 'Bad Email format',
        'email.require' => 'Email is required',
        'password.require' => 'Password is required',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'login' => ['user', 'password'],
        'register' => ['email', 'nickname', 'password'],
    ];
}
